package unit5;

import java.util.Scanner;
public class Example5_1 {
    public static void main(String args[]) {
        String str[] = { "北京", "山东", "上海" };
        int i = 0;
        while (i < 4) {
            try {
                System.out.println(str[i]);
            } catch (ArrayIndexOutOfBoundsException e) {
                System.out.println("数组下标越界");
            }
            finally {
                System.out.println("这行信息总是会打印，无论是否出现异常");
            }
            i++;
        }
    }
}
